-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix possible nil ptr in snapshot/pvc clone controllers #2900
Conversation
/lgtm |
/cc @mhenriks |
@@ -524,7 +524,7 @@ func isCrossNamespaceClone(dv *cdiv1.DataVolume) bool { | |||
} | |||
|
|||
// addCloneWithoutSourceWatch reconciles clones created without source once the matching PVC is created | |||
func addCloneWithoutSourceWatch(mgr manager.Manager, datavolumeController controller.Controller, typeToWatch client.Object, indexingKey string) error { | |||
func addCloneWithoutSourceWatch(mgr manager.Manager, datavolumeController controller.Controller, typeToWatch client.Object, indexingKey string, op dataVolumeOp) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Op
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the datavolume requested operation so one of these
containerized-data-importer/pkg/controller/datavolume/controller-base.go
Lines 157 to 164 in c512296
const ( | |
dataVolumeNop dataVolumeOp = iota | |
dataVolumeImport | |
dataVolumeUpload | |
dataVolumePvcClone | |
dataVolumeSnapshotClone | |
dataVolumePopulator | |
) |
spec.source.snapshot index pointing to a spec.source.pvc data volume key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so Op means operation, could you just name it operation, so everyone understands what it means? I was trying to figure out what it stood for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So op
is consistent across the project, should I refactor?
We slap on the clone-without-source index key regardless of source.PVC/source.Snapshot so it was possible for a DV with PVC source to get queued for the snapshot controller (and hence the nil ptr). The test addition demonstrates a real use case where this would happen. Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
c512296
to
1db47ec
Compare
/retest-required |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awels The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherrypick release-v1.57 |
@akalenyu: new pull request created: #2905 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
We slap on the clone-without-source index key regardless of source.PVC/source.Snapshot so
it was possible for a DV with PVC source to get queued for the snapshot controller
(and hence the nil ptr).
The test addition demonstrates a real use case where this would happen.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
https://issues.redhat.com/browse/CNV-33002
Special notes for your reviewer:
Release note: